<!DOCTYPE html>
<html>
<head>
<meta content='text/html;charset=utf-8' http-equiv='content-type'>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<script type="text/javascript" src="../../../../../../assets/gallery/handlebars/2.0.0/handlebars.js"></script>
<script type="text/javascript" src="../../../../../../assets/jquery/jquery/jquery.js"></script>
<script id="seajsnode" type="text/javascript" src="../../../../../../assets/seajs/seajs/2.2.1/sea.js"></script>
</head>
<style type="text/css">
	*{
		margin: 0px; 
		padding: 0px;
		
		font-family: Microsoft YaHei;
	    font-size: 14px;
	    line-height: 1.42857;
	    color: #333333;
	}
	body{
		padding:10px;
	}
	p{
		line-height:2
	}
	#title{
		margin: 10px;
	}
	#title table{
		width:100%;
	}
	.label{
		padding: 5px;
		width:15%;
	}
	.value{
		width:35%;
		padding: 5px;
	}
	#footer{
		margin: 10px;
	}
	.tableStyle{
		padding: 15px;
	}
	.tableStyle table{
		width:100%;
	}
	.tableStyle table td{
		padding:0px 15px;
	}
	.tableStyle table td:FIRST-CHILD{
		width:50%;
		padding:5px;
	}
	.tableStyle table td:LAST-CHILD{
		width:50%;
		padding:5px;
	}
	.tableStyle table.mystyle
	{
	    border-width: 0 0 1px 1px;
	    border-spacing: 0;
	    border-collapse: collapse;
	    border-style: solid;
	}
	 
	.mystyle td, .mystyle th
	{
	    margin: 0;
	    padding: 5px;
	    border-width: 1px 1px 0 0;
	    border-style: solid;
	    width:50%;
	}	
	
</style>
<body>
<div><img src="../../../../../../assets/eling/theme/yhy/printlogo.png"></div>
	
	<div id="title">
		<table>
			<tr>
				<td class="label">目的地：</td>
				<td class="value"><span id="destination"></span></td>
				<td class="label">报名人数：</td>
				<td class="value"><span id="signUpNumber"></span></td>
			</tr>
			<tr>
				<td class="label">入住日期：</td>
				<td class="value"><span id="checkInDate"></span></td>
				<td class="label">退住日期：</td>
				<td class="value"><span id="checkOutDate"></span></td>
			</tr>
		</table>
	</div>
	<div id="grid" class = "tableStyle"></div>
	<div id="personal" class = "tableStyle"></div>
	<div id="describe" class = "tableStyle">
		<table class="mystyle">
			<tr>
				<td>
					<p><font size='1' face="黑体">地址：千岛湖镇淳杨线港口路666-668号</font></p>
					<p><font size='1' face="黑体">电话：0571-24829999</font></p>
					<p><font size='1' face="黑体">开户行：建行淳安支行（基本户）</font></p>
					<p><font size='1' face="黑体">账号：33050161763509888666</font></p>
				</td>
				<td>
					<p><font size='1' face="黑体">本人已查看并且上述金额无误，如转账无效，本人愿意承担账单所列未清及最后欠额。</font></p>
					<p><font size='1' face="黑体">签署人：</font></p>
					<p><font size='1' face="黑体">电话：</font></p>
				</td>
			</tr>
		</table>
	</div>
	<div id="footer">
		<table>
			<tr>
				<td class="label">经办人：</td>
				<td class="value"><span id="operatorName"></span></td>
				<td class="label">结算日期：</td>
				<td class="value"><span id="statementDate"></span></td>
			</tr>
		</table>
	</div>
	
	<script type="text/x-handlebars-template" id="template1">
		<table class="mystyle">
			<tr>
				<td>项目</td>
				<td>费用</td>
			</tr>
			<tr>
				<td>联盟酒店费用合计：</td>
				<td>{{this.allianceChargesTotal}}</td>
			</tr>
			<tr>
				<td>组团管理费合计：</td>
				<td>{{this.manageChargesTotal}}</td>
			</tr>
			<tr>
				<td>其他费用合计：</td>
				<td>{{this.otherChargesTotal}}</td>
			</tr>
			<tr>
				<td>费用总金额：</td>
				<td>{{this.allTotal}}</td>
			</tr>
			<tr>
				<td>预收款合计：</td>
				<td>{{this.depositTotal}}</td>
			</tr>
			<tr>
				<td>权证抵扣合计：</td>
				<td>{{this.deductionChargesTotal}}</td>
			</tr>
			<tr>
				<td>应收金额合计：</td>
				<td>{{this.receivableTotal}}</td>
			</tr>
			<tr>
				<td>实收金额合计：</td>
				<td>{{this.receiptsTotal}}</td>
			</tr>
			<tr>
				<td>结算方式：</td>
				<td>{{this.paymentMethod}}</td>
			</tr>
			<tr>
				<td>备注：</td>
				<td>{{this.description}}</td>
			</tr>			
		</table>
	</script>
	<script type="text/x-handlebars-template" id="template2">
		<table class="mystyle">
			<thead>
				<tr>
					<td>项目</td>
					<td>费用</td>
				</tr>
			</thead>
			<tbody>		
				<tr>
					<td>住宿费合计：</td>
					<td>{{this.roomTotal}}</td>
				</tr>
				<tr>
					<td>大交通往返费合计：</td>
					<td>{{this.trafficTotal}}</td>
				</tr>
				<tr>
					<td>其他费用合计：</td>
					<td>{{this.otherTotal}}</td>
				</tr>
				<tr>
					<td>费用总金额：</td>
					<td>{{this.allTotal}}</td>
				</tr>
				<tr>
					<td>预收款合计：</td>
					<td>{{this.depositTotal}}</td>
				</tr>
				<tr>
					<td>权证抵扣合计：</td>
					<td>{{this.deductionChargesTotal}}</td>
				</tr>
				<tr>
					<td>应收金额合计：</td>
					<td>{{this.receivableTotal}}</td>
				</tr>
				<tr>
					<td>实收金额合计：</td>
					<td>{{this.receiptsTotal}}</td>
				</tr>
				<tr>
					<td>结算方式：</td>
					<td>{{this.paymentMethod}}</td>
				</tr>
				<tr>
					<td>备注：</td>
					<td>{{this.description}}</td>
				</tr>
			</tbody>
		</table>
	</script>
	<script type="text/x-handlebars-template" id="template3">
		<table class="mystyle">
			<thead>
				<tr>
                	<td>姓名</td>
                	<td>房间</td>
            	</tr>
			</thead>
			<tbody>			
			{{#each this}}
				<tr>
					<td>{{this.name}}</td>
					<td>{{this.code}}</td>
				</tr>
			{{/each}}
			</toby>
		</table>
	</script>
	<script type="text/javascript">
	
		function getQueryString(name){
	        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
	        var r = window.location.search.substr(1).match(reg);  
	        var context = "";
	        if (r != null)
	            context = r[2];
	        reg = null;
	        r = null;
	        return context == null || context == "" || context == "undefined" ? "" : decodeURI(context);
	    }
		
       	seajs.use('moment/moment-2.9.0.js',function(moment){
       		var obj = getQueryString("obj");
       		obj = JSON.parse(obj);
       		
       		
       		$("#destination").text(obj.destination);
       		$("#signUpNumber").text(obj.signUpNumber);
       		$("#checkInDate").text(moment(obj.checkInDate).format("YYYY-MM-DD"));
       		$("#checkOutDate").text(moment(obj.checkOutDate).format("YYYY-MM-DD"));
       		$("#operatorName").text(obj.operatorName);
       		$("#statementDate").text(moment(obj.statementDate).format("YYYY-MM-DD"));
       		
       		var paymentMethod = [];
       		if(obj.tatalGrid.length >= 0){
       			for(var i = 0;i<obj.tatalGrid[0].paymentMethod.length;i++){
       				paymentMethod.push(obj.tatalGrid[0].paymentMethod[i].value);
       			}
       		}
       		
       		var templateData = obj.tatalGrid[0];
       		templateData.allTotal = templateData.allTotal?templateData.allTotal.toFixed(2):0.00;
       		templateData.deductionChargesTotal = templateData.deductionChargesTotal?templateData.deductionChargesTotal.toFixed(2):0.00;
       		templateData.depositTotal = templateData.depositTotal?templateData.depositTotal.toFixed(2):0.00;
       		templateData.foodTotal = templateData.foodTotal?templateData.foodTotal.toFixed(2):0.00;
       		templateData.otherTotal = templateData.otherTotal?templateData.otherTotal.toFixed(2):0.00;
       		templateData.receiptsTotal = templateData.receiptsTotal?templateData.receiptsTotal.toFixed(2):0.00;
       		templateData.receivableTotal = templateData.receivableTotal?templateData.receivableTotal.toFixed(2):0.00;
       		templateData.roomTotal = templateData.roomTotal?templateData.roomTotal.toFixed(2):0.00;
       		templateData.trafficTotal = templateData.trafficTotal?templateData.trafficTotal.toFixed(2):0.00;
       		if(obj.teamType == "直属入住联盟"){
       			obj.tatalGrid[0].paymentMethod = paymentMethod.join(",");
       			var template = $("#template1").text();
   				$("#grid").html(Handlebars.compile(template)(templateData)); 
       		}else{
       			obj.tatalGrid[0].paymentMethod = paymentMethod.join(",");
       			var template = $("#template2").text();
   				$("#grid").html(Handlebars.compile(template)(templateData)); 
       		}
       		var template3 = $("#template3").text();
       		$("#personal").html(Handlebars.compile(template3)(obj.endGrid));
       		window.print();
   		});
        	
    </script>
</body>
</html>